<!DOCTYPE html>
<html>
	<head> 
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>重置密码</title>
		<link rel="stylesheet" href="__TMPL__Public/css/normalize.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/main.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/style.css" />
	</head>
	<body >
		<div style="height: 10px;"></div>
		<div class="rst_registerbg">
			<div class="r_line">
				<span><img src="__TMPL__Public/img/user/r_account_b.png"></span>
				<input id="mobile" name="mobile" placeholder="用户名" autocomplete="off"/>
			</div>
			<div class="r_line">
				<span><img src="__TMPL__Public/img/user/r_valite_b.png"></span>
				<input id="code" name="code" style="width: 40%;" autocomplete="off" placeholder="验证码"/>
				<button type="button" style="width:70px;" onclick="dd()" id="send" class="prim-bg">获取验证码</button>
			</div>
			<div class="r_line">
				<span><img src="__TMPL__Public/img/user/r_pwd_b.png"></span>
				<input id="pwd" type="password" name="pwd" placeholder="请输入密码"/>
			</div>
			<div class="r_line">
				<span><img src="__TMPL__Public/img/user/r_pwd_b.png"></span>
				<input id="c_pwd" type="password" name="c_pwd" placeholder="请确认密码"/>
			</div>
		</div>
		<button type="button" onclick="rr()" class="regbtn ww7 prim-bg">重 置</button>
		<!--<div onclick="jsnativelogin()" style="color: #333; font-size: 14px;margin: 0;" class="regbtn">立即登录></div>-->
	</body>
	<script src="__TMPL__Public/js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
	<script src="__TMPL__Public/js/main.js?{$version}"></script>
	<script type="text/javascript">
		var cd = new countdown();
		cd.init("send");
		function dd(){
			var mobile = $("#mobile").val();
			if(mobile.length==0){
				alert("请输入手机号码");return;
			}
			if(mobile.length!=11){
				alert("格式不正确");return;
			}
			$.post("/api/appUser/get_msg_code/",
				{
					"user_account":mobile,
					"type":2
				},
				function(data){
					console.log(data);
					if(data.status){
						cd.start();
					}else{
						alert(data.msg);
					}
				},"json");
		}
		function rr(){
			var mobile = $("#mobile").val();
			var code = $("#code").val();
			var pwd = $("#pwd").val();
			var c_pwd = $("#c_pwd").val();
			if(mobile.length==0){
				alert("请输入手机号码");return;
			}
			if(mobile.length!=11){
				alert("格式不正确");return;
			}
			if(code.length==0){
				alert("请输入验证码");return;
			}
			if(pwd.length==0){
				alert("请输入密码");return;
			}
			if(c_pwd.length==0){
				alert("请确认密码");return;
			}if(c_pwd!=pwd){
				alert("两次输入的密码不一致");return;
			}
			$.post(
				"/HAction/resetpwd",
			{
				"user_account":mobile,
				"message_code":code,
				"password":pwd,
				"c_password":c_pwd
			},function(data){
				console.log(data);
				if(data.status){
					alert(data.info);
					jsnativelogin();
				}else{
					alert(data.info);
				}
			},"json");
		}
	</script>
</html>
